- EV’s, wind turbines, solar panels are mineral-intensive
- U.S. rapidly expanding mining for “green” technologies
- mining: H20-intensive, toxic wastes that degrade water, air, soil
2022-03-10
tidyverse package to retrieve census-designated places + counties and demographics (population size, income, race + ethnicity)###census api key
census_api_key("7492e696e8c0d9bcb8a075682c4dd9e68aad700a", install=TRUE, overwrite=TRUE)
###state #population,income,white,hisp/lat
state <- get_acs(geography = "state",
variables = c("B01003_001", #total pop
"B19013_001", #med household income
"B19301_001", #per capita income
"B02001_002", #white alone (race)
"B02001_001", #total pop (race)
"B03003_003", #hisp/lat (hisp/lat)
"B03003_001"), #total pop (hisp/lat)
year = 2019,
geometry=TRUE,
output="wide") %>%
filter(NAME!="Alaska" & NAME!="Hawaii" & NAME!="Puerto Rico") %>%
rename(state_pop=B01003_001E,
state_medHouseholdIncome=B19013_001E,
state_perCapInc=B19301_001E,
state_race_whitePop=B02001_002E,
state_race_totalPop=B02001_001E,
state_hisp_lat_yes=B03003_003E,
state_hisp_lat_totalPop=B03003_001E) %>%
mutate(state_prop_race_nonwhitePop=round((1-state_race_whitePop/state_race_totalPop),2),
state_prop_hisp_lat_yes=round((state_hisp_lat_yes/state_hisp_lat_totalPop),2)) %>%
st_transform(crs=4326)
###relevant state variables to join to mines
state2 <- state %>%
select(NAME,
state_medHouseholdIncome,
state_perCapInc,
state_prop_race_nonwhitePop,
state_prop_hisp_lat_yes) %>%
st_drop_geometry()
###mines in U.S. #cobalt, lithium, tellurium, rare earths
minesKeyMinerals <- minesRaw %>% #filter to key minerals
filter(grepl("Cobalt|Lithium|Tellurium|Rare-Earth Elements", CRITICAL_MINERAL)) %>%
st_transform(crs=4326) %>%
left_join(state2,by=c("LOC_DETAIL"="NAME"))
###create 35-mile buffer polygons around mines #cobalt, lithium, tellurium, rare earths
buffer <- st_buffer(minesKeyMinerals, dist = 56327) %>% #in meters
st_transform(crs=4326)
###county #population,income,white,hisp/lat
county <- get_acs(geography = "county",
variables = c("B01003_001", #total pop
"B19013_001", #med household income
"B19301_001", #per capita income
"B02001_002", #white alone (race)
"B02001_001", #total pop (race)
"B03003_003", #hisp/lat
"B03003_001"), #total pop (hisp/lat)
year = 2019,
geometry=TRUE,
output="wide") %>%
separate(NAME,into=c("County","State"),sep=", ") %>%
filter(State!="Alaska" & State!="Hawaii" & State!="Puerto Rico") %>%
rename(pop=B01003_001E,
medHouseholdIncome=B19013_001E,
perCapInc=B19301_001E,
race_whitePop=B02001_002E,
race_totalPop=B02001_001E,
hisp_lat_yes=B03003_003E,
hisp_lat_totalPop=B03003_001E) %>%
mutate(prop_race_nonwhitePop=round((1-race_whitePop/race_totalPop),2),
prop_hisp_lat_yes=round((hisp_lat_yes/hisp_lat_totalPop),2)) %>%
st_transform(crs=4326)
###place #population,income,white,hisp/lat
place <- get_acs(geography = "place",
variables = c("B01003_001", #total pop
"B19013_001", #med household income
"B19301_001", #per capita income
"B02001_002", #white alone (race)
"B02001_001", #total pop (race)
"B03003_003", #hisp/lat (hisp/lat)
"B03003_001"), #total pop (hisp/lat)
year = 2019,
geometry=TRUE,
output="wide") %>%
separate(NAME,into=c("County","State"),sep=", ") %>%
filter(State!="Alaska" & State!="Hawaii" & State!="Puerto Rico") %>%
rename(pop=B01003_001E,
medHouseholdIncome=B19013_001E,
perCapInc=B19301_001E,
race_whitePop=B02001_002E,
race_totalPop=B02001_001E,
hisp_lat_yes=B03003_003E,
hisp_lat_totalPop=B03003_001E) %>%
mutate(prop_race_nonwhitePop=round((1-race_whitePop/race_totalPop),2),
prop_hisp_lat_yes=round(hisp_lat_yes/hisp_lat_totalPop),2) %>%
st_transform(crs=4326)
placeCentroid <- place %>% #places to centroids
st_centroid()
intersectCentroid <- st_intersection(placeCentroid, buffer) #centroids in buffer
minesMapPlaceCentroids_buffer <- ggplot() +
geom_polygon(data=base1, fill="white", color="grey45", size=0.3,
aes(x=long, y=lat, group=group)) + #add base map
geom_sf(data=intersectCentroid, color="grey70") + #add places
geom_sf(data=buffer, fill=NA, linetype="dotted", color="red", size=0.3)+
geom_point(data=minesKeyMinerals, color="slateblue",
aes(x=LONGITUDE, y=LATITUDE,
text=paste(CRITICAL_MINERAL))) + #add mines
theme_minimal()+ #remove grey background
theme(legend.position="none", #remove legend, axes labels/ticks
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()) +
ggtitle("Select Places in 35-mile Buffer")
ggplotly(minesMapPlaceCentroids_buffer,tooltip="text") %>% #make interactive style(hoverinfo="none", traces=c(1:3))
intersect <- st_intersection(county, buffer) %>%
sf::st_cast("MULTIPOLYGON") #counties in buffer
fullCounties_buffer <- county %>%
filter(GEOID %in% intersect$GEOID) #select full counties
mapMines_fullCounties_buffer <- ggplot() +
geom_sf(data=county, color="grey45", size=0.3, fill=NA)+ #add base map
geom_sf(data=fullCounties_buffer, color="grey45", size=0.3, fill="grey75")+
geom_sf(data=buffer, fill=NA, linetype="dotted", size=0.3, color="red")+ #add buffer
geom_point(data=minesKeyMinerals, color="slateblue",
aes(x=LONGITUDE, y=LATITUDE,
text=paste("",CRITICAL_MINERAL))) + #add mines
theme_minimal()+ #remove grey background
theme(legend.position="none", #remove legend, axes labels/ticks
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()) +
ggtitle("Select Counties in 35-mile Buffer")
ggplotly(mapMines_fullCounties_buffer, tooltip="text") %>% #make interactive style(hoverinfo="none", traces=c(1:3))